/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.util;


import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;

/**
 *
 * @author jasuke
 */
public class ValidateFieldRequired implements javax.faces.validator.Validator{
    
    @Override
    public void validate(FacesContext context, UIComponent component, Object value)
			throws ValidatorException {

        //component.getAttributes().containsKey(value);

        if(value.equals("") || value==null) {
            FacesMessage message = new FacesMessage();
            message.setSeverity(FacesMessage.SEVERITY_WARN);
            message.setSummary("Inputan harus diisi");
            
            //context.addMessage("userForm:Email", message);
            
            throw new ValidatorException(message);
	}
    }
    

    
}
